package  
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.net.URLLoader;
	import flash.net.URLLoaderDataFormat;
	import flash.net.URLRequest;
	import flash.net.URLRequestMethod;
	import flash.net.URLVariables;
	
	/**
	 * ...
	 * @author ...
	 */
	public class Php2AS extends Sprite 
	{
		private var _urlV:BaseURLVariable;
		
		public function Php2AS() 
		{
			_urlV = new BaseURLVariable;
			_urlV.userName = "";
			_urlV.email = "";
			
			// Prepare request 
			var request:URLRequest = new URLRequest("http://dcharry.scienceontheweb.net/userInfo.php");
			request.method = URLRequestMethod.POST;
			
			var loader:URLLoader = new URLLoader();
			loader.dataFormat = URLLoaderDataFormat.VARIABLES;
			loader.addEventListener(Event.COMPLETE, completeHandler);
			loader.load(request);
		}
		
		private function completeHandler(evt:Event):void
		{
			var username:String = evt.target.data.username;
			var email:String = evt.target.data.email;
			
			_urlV.userName = username;
			_urlV.email = email;
			
			trace ('username is ' + username, _urlV.userName);
			trace ('email is ' + email, _urlV.email);
		}
	}

}